home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO6.DMS / in.adf / Procedures / Graphics / _Polygons.AMOS / _Polygons.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-29  |  1.5 KB  |  54 lines

  1. '******************************************************* 
  2. '*                                                     * 
  3. '* AMOS Professional Procedure Library                 * 
  4. '*                                                     * 
  5. '* Procedure: Polygon Drawer                           *   
  6. '*                                                     * 
  7. '*    Author: David Templar                            *   
  8. '*                                                     * 
  9. '******************************************************* 
  10.  
  11. ' Syntax  : _POLYGON[_XCOOR,_YCOOR,_POINTS,_XSIZE,_YSIZE,_ANGLE,_FILLED]       
  12.  
  13. Screen Open 0,320,200,16,Lowres
  14. Curs Off : Flash Off : Paper 0 : Cls 0
  15. Ink 2,6
  16. X=25
  17. For R=1 To 7
  18.    _POLYGON[X,25,4,20,20,38+(R*7),1]
  19.    Add X,45
  20. Next R
  21. Set Pattern 18
  22. _POLYGON[160,120,8,70,70,0,1]
  23. _POLYGON[50,120,5,30,30,54,0]
  24. For R=1 To 10
  25.    _POLYGON[270,120,3,35,35,R*12,0]
  26. Next R
  27.  
  28. Procedure _POLYGON[_XCOOR,_YCOOR,_POINTS,_XSIZE,_YSIZE,_ANGLE,_FILLED]
  29.    Degree 
  30.    If _POINTS<3
  31.       _POINTS=3
  32.    End If 
  33.    If _POINTS>360
  34.       _POINTS=360
  35.    End If 
  36.    If _FILLED<0 or _FILLED>1
  37.       _FILLED=0
  38.    End If 
  39.    For R=0+_ANGLE To 359+_ANGLE Step 360/_POINTS
  40.       X1=_XCOOR+Cos(R)*_XSIZE
  41.       X2=_XCOOR+Cos(R+360/_POINTS)*_XSIZE
  42.       Y1=_YCOOR+Sin(R)*_YSIZE
  43.       Y2=_YCOOR+Sin(R+360/_POINTS)*_YSIZE
  44.       If R=0+_ANGLE
  45.          Plot X1,Y1
  46.       End If 
  47.       If _FILLED=0
  48.          Polyline X1,Y1 To X2,Y2
  49.       End If 
  50.       If _FILLED=1
  51.          Polygon _XCOOR,_YCOOR To X1,Y1 To X2,Y2 To _XCOOR,_YCOOR
  52.       End If 
  53.    Next R
  54. End Proc